Make the entire expander widget width prelight as suggested by Seth in bug
authorMark McLoughlin <mark@skynet.ie>
Thu, 19 Feb 2004 08:52:16 +0000 (08:52 +0000)
committerMark McLoughlin <markmc@src.gnome.org>
Thu, 19 Feb 2004 08:52:16 +0000 (08:52 +0000)
2004-02-19  Mark McLoughlin  <mark@skynet.ie>

        Make the entire expander widget width prelight as suggested
        by Seth in bug #134263.

        * gtk/gtkexpander.c:
        (gtk_expander_paint_prelight): impl.
        (gtk_expander_paint): use it.
        (gtk_expander_redraw_expander): don't only redraw the
        arrow when prelit.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkexpander.c

index 53e1f11230dc37391d71118917f82c5195ac7864..8b2d7f72bce0af5999d02056ff16dfa61a39ffff 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2004-02-19  Mark McLoughlin  <mark@skynet.ie>
+
+       Make the entire expander widget width prelight as suggested
+       by Seth in bug #134263.
+
+       * gtk/gtkexpander.c:
+       (gtk_expander_paint_prelight): impl.
+       (gtk_expander_paint): use it.
+       (gtk_expander_redraw_expander): don't only redraw the
+       arrow when prelit.
+
 2004-02-19  Alexander Larsson  <alexl@redhat.com>
 
        * gtk/gtkfilechooser.c: (gtk_file_chooser_class_init):
index 53e1f11230dc37391d71118917f82c5195ac7864..8b2d7f72bce0af5999d02056ff16dfa61a39ffff 100644 (file)
@@ -1,3 +1,14 @@
+2004-02-19  Mark McLoughlin  <mark@skynet.ie>
+
+       Make the entire expander widget width prelight as suggested
+       by Seth in bug #134263.
+
+       * gtk/gtkexpander.c:
+       (gtk_expander_paint_prelight): impl.
+       (gtk_expander_paint): use it.
+       (gtk_expander_redraw_expander): don't only redraw the
+       arrow when prelit.
+
 2004-02-19  Alexander Larsson  <alexl@redhat.com>
 
        * gtk/gtkfilechooser.c: (gtk_file_chooser_class_init):
index 53e1f11230dc37391d71118917f82c5195ac7864..8b2d7f72bce0af5999d02056ff16dfa61a39ffff 100644 (file)
@@ -1,3 +1,14 @@
+2004-02-19  Mark McLoughlin  <mark@skynet.ie>
+
+       Make the entire expander widget width prelight as suggested
+       by Seth in bug #134263.
+
+       * gtk/gtkexpander.c:
+       (gtk_expander_paint_prelight): impl.
+       (gtk_expander_paint): use it.
+       (gtk_expander_redraw_expander): don't only redraw the
+       arrow when prelit.
+
 2004-02-19  Alexander Larsson  <alexl@redhat.com>
 
        * gtk/gtkfilechooser.c: (gtk_file_chooser_class_init):
index 53e1f11230dc37391d71118917f82c5195ac7864..8b2d7f72bce0af5999d02056ff16dfa61a39ffff 100644 (file)
@@ -1,3 +1,14 @@
+2004-02-19  Mark McLoughlin  <mark@skynet.ie>
+
+       Make the entire expander widget width prelight as suggested
+       by Seth in bug #134263.
+
+       * gtk/gtkexpander.c:
+       (gtk_expander_paint_prelight): impl.
+       (gtk_expander_paint): use it.
+       (gtk_expander_redraw_expander): don't only redraw the
+       arrow when prelit.
+
 2004-02-19  Alexander Larsson  <alexl@redhat.com>
 
        * gtk/gtkfilechooser.c: (gtk_file_chooser_class_init):
index 53e1f11230dc37391d71118917f82c5195ac7864..8b2d7f72bce0af5999d02056ff16dfa61a39ffff 100644 (file)
@@ -1,3 +1,14 @@
+2004-02-19  Mark McLoughlin  <mark@skynet.ie>
+
+       Make the entire expander widget width prelight as suggested
+       by Seth in bug #134263.
+
+       * gtk/gtkexpander.c:
+       (gtk_expander_paint_prelight): impl.
+       (gtk_expander_paint): use it.
+       (gtk_expander_redraw_expander): don't only redraw the
+       arrow when prelit.
+
 2004-02-19  Alexander Larsson  <alexl@redhat.com>
 
        * gtk/gtkfilechooser.c: (gtk_file_chooser_class_init):
index b839bf434b6a2992f54af04af77870036f3df5e2..780f30504f1715467e11c854115de6f1fb5883c8 100644 (file)
@@ -699,6 +699,52 @@ gtk_expander_unmap (GtkWidget *widget)
     gtk_widget_unmap (priv->label_widget);
 }
 
+static void
+gtk_expander_paint_prelight (GtkExpander *expander)
+{
+  GtkWidget *widget;
+  GtkContainer *container;
+  GtkExpanderPrivate *priv;
+  GdkRectangle area;
+  gboolean interior_focus;
+  int focus_width;
+  int focus_pad;
+  int expander_size;
+  int expander_spacing;
+
+  priv = expander->priv;
+  widget = GTK_WIDGET (expander);
+  container = GTK_CONTAINER (expander);
+
+  gtk_widget_style_get (widget,
+                       "interior-focus", &interior_focus,
+                       "focus-line-width", &focus_width,
+                       "focus-padding", &focus_pad,
+                       "expander-size", &expander_size,
+                       "expander-spacing", &expander_spacing,
+                       NULL);
+
+  area.x = widget->allocation.x + container->border_width;
+  area.y = widget->allocation.y + container->border_width;
+  area.width = widget->allocation.width - (2 * container->border_width);
+
+  if (priv->label_widget && GTK_WIDGET_VISIBLE (priv->label_widget))
+    area.height = priv->label_widget->allocation.height;
+  else
+    area.height = 0;
+
+  area.height += interior_focus ? (focus_width + focus_pad) * 2 : 0;
+  area.height = MAX (area.height, expander_size + 2 * expander_spacing);
+  area.height += !interior_focus ? (focus_width + focus_pad) * 2 : 0;
+
+  gtk_paint_flat_box (widget->style, widget->window,
+                     GTK_STATE_PRELIGHT,
+                     GTK_SHADOW_ETCHED_OUT,
+                     &area, widget, "expander",
+                     area.x, area.y,
+                     area.width, area.height);
+}
+
 static void
 gtk_expander_paint (GtkExpander *expander)
 {
@@ -712,7 +758,11 @@ gtk_expander_paint (GtkExpander *expander)
 
   state = widget->state;
   if (expander->priv->prelight)
-    state = GTK_STATE_PRELIGHT;
+    {
+      state = GTK_STATE_PRELIGHT;
+
+      gtk_expander_paint_prelight (expander);
+    }
 
   gtk_paint_expander (widget->style,
                      widget->window,
@@ -859,15 +909,12 @@ gtk_expander_state_changed (GtkWidget    *widget,
 static void
 gtk_expander_redraw_expander (GtkExpander *expander)
 {
-  GdkRectangle bounds;
+  GtkWidget *widget;
 
-  get_expander_bounds (expander, &bounds);
+  widget = GTK_WIDGET (expander);
 
-  gtk_widget_queue_draw_area (GTK_WIDGET (expander),
-                             bounds.x,
-                             bounds.y,
-                             bounds.width,
-                             bounds.height);
+  if (GTK_WIDGET_REALIZED (widget))
+    gdk_window_invalidate_rect (widget->window, &widget->allocation, FALSE);
 }
 
 static gboolean